package cn.pugle.ormtest.ebean.domain;

import cn.pugle.ormtest.ebean.domain.finder.CustomerFinder;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.ebean.Model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import java.util.List;

/**
 * @author tzp
 * @date 2017/12/22
 */
@Entity
@Table(name = "st_customer2")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CustomerModel2 extends Model {
    public static final CustomerFinder finder = new CustomerFinder();//或许叫dao之类的也行

    @Id
    Long id;

    String name;

    Integer gender;

    Integer type;

    /**
     * 级联删ok: cascade = CascadeType.REMOVE
     * */
    @OneToMany(mappedBy = "customer")
    @JsonIgnore
    List<OrderModel2> orders;
}
